import request from './request'

export const categoryService = {
  // 获取所有商品分类
  async getCategoryList() {
    return await request({
      url: 'Category/list',
      method: 'GET'
    })
  },
  
  // 获取顶级商品分类
  async getTopCategories() {
    return await request({
      url: 'Category/topList',
      method: 'GET'
    })
  },
  
  // 获取分类详情
  async getCategoryDetail(id) {
    return await request({
      url: `Category/detail/${id}`,
      method: 'GET'
    })
  },
  
  // 创建新分类
  async createCategory(data) {
    return await request({
      url: 'Category/create',
      method: 'POST',
      data
    })
  },
  
  // 更新分类
  async updateCategory(id, data) {
    return await request({
      url: `Category/update/${id}`,
      method: 'PUT',
      data
    })
  },
  
  // 删除分类
  async deleteCategory(id) {
    return await request({
      url: `Category/delete/${id}`,
      method: 'DELETE'
    })
  }
} 